<?php

namespace app\index\controller;

class Mailbox extends Base
{

    public function index($navid = null)
    {
        $datas = array();
        $post = $this->request->param();
        //领导介绍
        $hot = model('user')
            ->where($this->datas)
            ->where('type', 1)
            ->where('position', 0)->order('id deSC')->select();
        //最新信箱
        !empty($post['type']) ? $datas['type'] = $this->request->param('type') : '';
        $list = model('mailbox')
            ->where(['show' => '1'])
            ->where($datas)
            ->order('update_time deSC')
            ->paginate();
        $this->assign([
            'hot' => $hot,
            'list' => $list,
        ]);
        return $this->fetch($this->template . $this->request->controller() . '.html');
    }


    public function detailed($id)
    {
        $mailbox = model('mailbox')->where('id', $id)->find();

        $maillist = db('mailboxmass')->where('fid', $id)->select();
        $this->assign(
            [
                'data' => $mailbox,
                'list' => $maillist,
            ]
        );
        return $this->fetch($this->template . $this->request->controller() . 'detailed.html');
    }


}

